package com.settlement.system.service.impl;

import com.settlement.system.mapper.RrPlugInMapper;
import com.settlement.system.common.exception.ServiceException;
import com.settlement.system.model.entity.common.CommonPlugIn;
import com.settlement.system.model.entity.common.SinglePage;
import com.settlement.system.service.RrPlugInService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import jakarta.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author author
 */
@Service
@Slf4j
public class RrPlugInServiceImpl implements RrPlugInService {

    @Resource
    private RrPlugInMapper rrPlugInMapper;

    @Override
    public Integer getRecordAccountProjectCount(Map<String, Object> params) throws ServiceException {
        try {
            return rrPlugInMapper.getRecordAccountProjectCount(params);
        } catch (Exception ex) {
            log.error("获取记账项目数量异常", ex);
            throw new ServiceException("获取记账项目数量异常", ex);
        }
    }

    @Override
    public List<CommonPlugIn> getRecordAccountProject(SinglePage page, Map<String, Object> params, String orderByField, String orderBy) throws ServiceException {
        try {
            return rrPlugInMapper.getRecordAccountProject(page, params, orderByField, orderBy);
        } catch (Exception ex) {
            log.error("获取记账项目异常", ex);
            throw new ServiceException("获取记账项目异常", ex);
        }
    }

    @Override
    public Integer getNcEnterAccountBodyCount(Map<String, Object> params) throws ServiceException {
        try {
            return rrPlugInMapper.getNcEnterAccountBodyCount(params);
        } catch (Exception ex) {
            log.error("获取入账主体数量异常", ex);
            throw new ServiceException("获取入账主体数量异常", ex);
        }
    }

    @Override
    public Integer getWpRrVendorCount(Map<String, Object> params) throws ServiceException {
        try {
            return rrPlugInMapper.getWpRrVendorCount(params);
        } catch (Exception ex) {
            log.error("获取供应商名称数量异常", ex);
            throw new ServiceException("获取供应商名称数量异常", ex);
        }
    }


    @Override
    public Integer getWpRdBillCodeCount(Map<String, Object> params) throws ServiceException {
        try {
            return rrPlugInMapper.getWpRdBillCodeCount(params);
        } catch (Exception ex) {
            log.error("获取供应商编码数量异常", ex);
            throw new ServiceException("获取供应商编码数量异常", ex);
        }
    }

    @Override
    public List<CommonPlugIn> getWpRdBillCode(SinglePage page, Map<String, Object> params, String orderByField, String orderBy) throws ServiceException {
        try {
            return rrPlugInMapper.getWpRdBillCode(page, params, orderByField, orderBy);
        } catch (Exception ex) {
            log.error("获取入账主体异常", ex);
            throw new ServiceException("获取入账主体异常", ex);
        }
    }


    @Override
    public List<CommonPlugIn> getNcEnterAccountBody(SinglePage page, Map<String, Object> params, String orderByField, String orderBy) throws ServiceException {
        try {
            return rrPlugInMapper.getNcEnterAccountBody(page, params, orderByField, orderBy);
        } catch (Exception ex) {
            log.error("获取入账主体异常", ex);
            throw new ServiceException("获取入账主体异常", ex);
        }
    }

    @Override
    public List<CommonPlugIn> getWpRrVendor(SinglePage page, Map<String, Object> params, String orderByField, String orderBy) throws ServiceException {
        try {
            return rrPlugInMapper.getWpRrVendor(page, params, orderByField, orderBy);
        } catch (Exception ex) {
            log.error("获取供应商名称异常", ex);
            throw new ServiceException("获取供应商名称异常", ex);
        }
    }



    @Override
    public Integer getBillTypeCount(Map<String, Object> params) throws ServiceException {
        try {
            return rrPlugInMapper.getBillTypeCount(params);
        } catch (Exception ex) {
            log.error("获取账单类型数量异常", ex);
            throw new ServiceException("获取账单类型数量异常", ex);
        }
    }

    @Override
    public Integer getVoucherTypeCount(Map<String, Object> params) throws ServiceException {
        try {
            return rrPlugInMapper.getVoucherTypeCount(params);
        } catch (Exception ex) {
            log.error("获取账单类型数量异常", ex);
            throw new ServiceException("获取账单类型数量异常", ex);
        }
    }

    @Override
    public List<CommonPlugIn> getBillType(SinglePage page, Map<String, Object> params, String orderByField, String orderBy) throws ServiceException {
        try {
            return rrPlugInMapper.getBillType(page, params, orderByField, orderBy);
        } catch (Exception ex) {
            log.error("获取入账主体异常", ex);
            throw new ServiceException("获取入账主体异常", ex);
        }
    }

    @Override
    public List<CommonPlugIn> getVoucherType(SinglePage page, Map<String, Object> params, String orderByField, String orderBy) throws ServiceException {
        try {
            return rrPlugInMapper.getVoucherType(page, params, orderByField, orderBy);
        } catch (Exception ex) {
            log.error("获取入账主体异常", ex);
            throw new ServiceException("获取入账主体异常", ex);
        }
    }

    @Override
    public Integer getShopCount(Map<String, Object> params) throws ServiceException {
        try {
            return rrPlugInMapper.getShopCount(params);
        } catch (Exception ex) {
            log.error("获取店铺数量异常", ex);
            throw new ServiceException("获取店铺数量异常", ex);
        }
    }



    @Override
    public Integer getOfflineRemitAccountCount(Map<String, Object> params) throws ServiceException {
        try {
            return rrPlugInMapper.getOfflineRemitAccountCount(params);
        } catch (Exception ex) {
            log.error("获取线下打款账号数量异常", ex);
            throw new ServiceException("获取线下打款账号数量异常", ex);
        }
    }

    @Override
    public List<CommonPlugIn> getShop(SinglePage page, Map<String, Object> params, String orderByField, String orderBy) throws ServiceException {
        try {
            return rrPlugInMapper.getShop(page, params, orderByField, orderBy);
        } catch (Exception ex) {
            log.error("获取店铺异常", ex);
            throw new ServiceException("获取店铺异常", ex);
        }
    }



    @Override
    public List<CommonPlugIn> getOfflineRemitAccount(SinglePage page, Map<String, Object> params, String orderByField, String orderBy) throws ServiceException {
        try {
            return rrPlugInMapper.getOfflineRemitAccount(page, params, orderByField, orderBy);
        } catch (Exception ex) {
            log.error("获取线下打款账号异常", ex);
            throw new ServiceException("获取线下打款账号异常", ex);
        }
    }



    @Override
    public Integer getShopNameJdCount(Map<String, Object> params) throws ServiceException {
        try {
            return rrPlugInMapper.getShopNameJdCount(params);
        } catch (Exception ex) {
            log.error("获取店铺数量异常", ex);
            throw new ServiceException("获取店铺数量异常", ex);
        }
    }

    @Override
    public List<CommonPlugIn> getShopNameJd(SinglePage page, Map<String, Object> params, String orderByField, String orderBy) throws ServiceException {
        try {
            return rrPlugInMapper.getShopNameJd(page, params, orderByField, orderBy);
        } catch (Exception ex) {
            log.error("获取店铺异常", ex);
            throw new ServiceException("获取店铺异常", ex);
        }
    }

    @Override
    public Integer getEditorCount(Map<String, Object> params) throws ServiceException {
        try {
            return rrPlugInMapper.getEditorCount(params);
        } catch (Exception ex) {
            log.error("获取制单人数量异常", ex);
            throw new ServiceException("获取制单人数量异常", ex);
        }
    }

    @Override
    public List<CommonPlugIn> getEditor(SinglePage page, Map<String, Object> params, String orderByField, String orderBy) throws ServiceException {
        try {
            return rrPlugInMapper.getEditor(page, params, orderByField, orderBy);
        } catch (Exception ex) {
            log.error("获取制单人异常", ex);
            throw new ServiceException("获取制单人异常", ex);
        }
    }

    @Override
    public Integer getThreeChannelNoCount(Map<String, Object> params) throws ServiceException {
        try {
            return rrPlugInMapper.getThreeChannelNoCount(params);
        } catch (Exception ex) {
            log.error("获取三级来源数量异常", ex);
            throw new ServiceException("获取三级来源数量异常", ex);
        }
    }

    @Override
    public List<CommonPlugIn> getThreeChannelNo(SinglePage page, Map<String, Object> params, String orderByField, String orderBy) throws ServiceException {
        try {
            return rrPlugInMapper.getThreeChannelNo(page, params, orderByField, orderBy);
        } catch (Exception ex) {
            log.error("获取三级来源异常", ex);
            throw new ServiceException("获三级来源异常", ex);
        }
    }

    @Override
    public Integer getOrShopAccountCount(Map<String, Object> params) throws ServiceException {
        try {
            params.put("channelNo","OR");
            return rrPlugInMapper.getShopAccountCount(params);
        } catch (Exception ex) {
            log.error("获取线下打款账号数量异常", ex);
            throw new ServiceException("获取线下打款账号异常", ex);
        }
    }

    @Override
    public List<CommonPlugIn> getOrShopAccount(SinglePage page, Map<String, Object> params, String orderByField, String orderBy) throws ServiceException {
        try {
            params.put("channelNo","OR");
            return rrPlugInMapper.getShopAccount(page, params, orderByField, orderBy);
        } catch (Exception ex) {
            log.error("获取线下打款账号异常", ex);
            throw new ServiceException("获取下打款账号异常", ex);
        }
    }
}
